﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Sunny.Controls
{
	public class QueryEventArgs : System.Windows.RoutedEventArgs
	{
		public readonly Searcher.WhereCommand WhereCommand;
		public readonly string OrderCommand;
		public readonly ToolbarQueryAction Action;

		public QueryEventArgs(Searcher.WhereCommand whereCommand, string orderCommand)
		{
			this.WhereCommand = whereCommand;
			this.OrderCommand = orderCommand;
		}

		public QueryEventArgs(System.Windows.RoutedEvent routedEvent, Searcher.WhereCommand whereCommand, string orderCommand, ToolbarQueryAction action)
			: this(whereCommand, orderCommand)
		{
			this.Action = action;
		}

		protected override void InvokeEventHandler(Delegate genericHandler, object genericTarget)
		{
			var handler = (System.EventHandler<QueryEventArgs>)genericHandler;
			handler(genericTarget, this);
		}
	}
}